package edu.nuc.event.service;

import edu.nuc.event.dao.MatchMapper;
import edu.nuc.event.pojo.Match;
import edu.nuc.event.pojo.User;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MatchService {

    @Autowired
    private MatchMapper matchMapper;

    public List<Match> matchsByComId(int comid) {

        List<Match> matchs = matchMapper.matchsByComId(comid);
        return matchs;
    }

    public int demandaccountByComId(int comid) {
        int account = matchMapper.demandaccountByComId(comid);
        return account;
    }

    public Match findmatchbyuid(int userid) {
        Match match = matchMapper.findmatchbyuid(userid);
        return match;
    }

    public int addmatch(int userid, String word) {
        int i = matchMapper.addmatch(userid, word);
        return i;
    }

    public int updatematch(Match match) {
        int i = matchMapper.updatematch(match);
        return i;
    }

    public List<User> selectmatchbycom(int cpid) {
        List<User> userList = matchMapper.selectmatchbycom(cpid);
        return userList;
    }

    public Match selectmatchbyid(int id) {
        Match match = matchMapper.selectmatchbyid(id);
        return match;
    }

    public int updateprize(Match match) {
        int i = matchMapper.updateprize(match);
        return i;
    }

    public int addmatchuser(int userid) {
        int i = matchMapper.addmatchuser(userid);
        return i;
    }
}
